Skip to content

feat(fe): handle ICRC-3 attribute requests in default authorize flow#3791

Merged
sea-snake merged 11 commits intomainfrom
sea-snake/icrc3-default-flow
Apr 21, 2026
Merged

feat(fe): handle ICRC-3 attribute requests in default authorize flow#3791
sea-snake merged 11 commits intomainfrom
sea-snake/icrc3-default-flow

Conversation

@sea-snake
Copy link
Copy Markdown
Contributor

The ICRC-3 attribute handler previously only existed in the OpenID resume flow. Dapps using the default (non-OpenID) authorize flow that request ii-icrc3-attributes would get no response.

This adds an ICRC-3 attributes listener to the default authorize flow's AuthorizationChannel. Since the user didn't authenticate via OpenID, there are no attribute values to certify — the handler responds with only the implicit entries (nonce, origin, timestamp) by calling prepare_icrc3_attributes with an empty attributes list.

Changes

  • Added handleIcrc3AttributeRequests to AuthorizationChannel.svelte that listens for ii-icrc3-attributes, waits for authorization + authentication, then certifies an empty attribute set.

← Previous: #3770
Next: #3777

sea-snake and others added 8 commits April 21, 2026 08:50
- Attribute values (email, name, verified_email): Blob → Text
- implicit:origin: Blob → Text
- implicit:issued_at_timestamp_ns: Blob (string bytes) → Nat
- implicit:nonce: stays Blob (raw 32 bytes)
Reverts the silent omission behavior back to returning errors for
unavailable, unscoped, mismatched, and duplicate attributes. Now that
the frontend resolves attributes via list_available_attributes before
calling prepare, errors should surface so bugs are caught.
@sea-snake sea-snake force-pushed the sea-snake/icrc3-text-types branch from 151d340 to f46f40f Compare April 21, 2026 06:52
Listen for ii-icrc3-attributes requests in the normal (non-OpenID)
authorize flow. Responds with empty attributes (only implicit entries
like nonce, origin, timestamp) since the user didn't authenticate
via OpenID and has no attribute values to certify.
@sea-snake sea-snake force-pushed the sea-snake/icrc3-default-flow branch from 8d7cdb2 to f7fc345 Compare April 21, 2026 06:54
Base automatically changed from sea-snake/icrc3-text-types to main April 21, 2026 07:20
@sea-snake sea-snake added this pull request to the merge queue Apr 21, 2026
Merged via the queue into main with commit 5b311bf Apr 21, 2026
84 checks passed
@sea-snake sea-snake deleted the sea-snake/icrc3-default-flow branch April 21, 2026 08:23
aterga pushed a commit to timothyaterton/internet-identity that referenced this pull request Apr 21, 2026
…te values (dfinity#3770)

Certified attribute values were encoded as raw bytes (`Blob`) regardless
of their semantic type. This changes the ICRC-3 attribute message to use
the correct types: `Text` for string values (email, name), `Blob` for
binary data (nonce), and `Nat` for timestamps.

# Changes

- `prepare_icrc3_attributes` now produces `Icrc3Value::Text` for
attribute values, `Icrc3Value::Blob` for nonce, and `Icrc3Value::Nat`
for timestamps instead of encoding everything as `Blob`.
- `icrc3_attribute_message` accepts `BTreeMap<String, Icrc3Value>`
instead of `BTreeMap<String, Vec<u8>>`.
- E2e tests updated to verify correct ICRC-3 Value types in the decoded
attribute map.

---

<div align="left">← Previous: dfinity#3768</div>
<div align="right">Next: dfinity#3791 →</div>

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
pull Bot pushed a commit to mikeyhodl/internet-identity that referenced this pull request Apr 22, 2026
…architecture (dfinity#3777)

The authorize flow previously had request handling intertwined with UI
components — handlers would trigger UI changes directly, and UI
components would drive handler logic. This made the flow hard to follow
and brittle to change.

This PR introduces a clean separation: **handlers ← stores → UI**.
Channel handlers write to stores and observe stores (via
`waitForStore`). The UI reads stores to decide what to render, and
writes to stores when the user takes action. Neither side knows about
the other.

# Changes

- **Extract channel handlers into dedicated files.**
`channelHandlers/icrc25.ts` (standards, permissions),
`channelHandlers/delegation.ts` (ICRC-34), and
`channelHandlers/attributes.ts` (legacy + ICRC-3 attributes) — each
self-contained with their own imports.
- **Split authorization store into context and outcome.**
`authorizationStore` holds the request context (`effectiveOrigin`),
`authorizedStore` holds the outcome (`accountNumber`). Handlers
`waitForStore(authorizedStore)` instead of polling a combined state.
- **Add `waitForStore` utility.** Generic helper that resolves when a
Svelte store value satisfies a condition — eliminates repeated
subscribe/unsubscribe boilerplate across handlers.
- **Gate attribute handlers on dapp opt-in.** Attributes are only served
to known dapps with `certifiedAttributes: true`, or in dev environments
(`fetch_root_key`). Unknown origins get an error response.
- **Channel error component.** Extracted `ChannelError.svelte` with
per-error-type messages, shared across channel, pending-channel, and
resuming-channel layouts.
- **Fix pending/resuming channel layout guards.** Pending-channel now
renders errors. Resuming-channel waits for channel establishment before
rendering children, shows errors when appropriate.
- **Remove `AuthorizationChannel.svelte`.** Layouts call
`channelStore.establish()` directly and gate rendering on store state.

---

<div align="left">← Previous: dfinity#3791</div>
<div align="right">Next: dfinity#3781 →</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants